package com.cw.jeeyt.common.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * 加密工具类
 *
 * @author: chenw
 * @create: 2018-11-09 01:29
 */
public class PasswordEncodeUtil {
    private static BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();

    /**
     * 加密
     *
     * @param password
     * @return
     */
    public static String encode(String password) {
        return bCryptPasswordEncoder.encode(password);
    }

    public static boolean matches(String password, String newPassword) {
        return bCryptPasswordEncoder.matches(password, newPassword);
    }

    public static void main(String[] args) {

        System.out.println(PasswordEncodeUtil.encode("weisite1"));
    }
}
